<?php
/*
	排队
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
if($_RQ['store_id']){
	$store_id = intval($_RQ['store_id']);
	$this->session('store_id',$store_id);
}
if(!$store_id){
	$store_id=$this->session('store_id');
}
if(!$store_id){
	exi('请先选择场馆！','error','jy_qiuyuyue/index/');
}
if($_RQ['op']=='main'){
	$return['params']=array();
	$queue = pdo_getall('jy_qiuyuyue_queue',array('uniacid'=>$_SESSION['uniacid'],'store_id'=>$store_id,'status'=>1),'','',' display desc');
	$params=array(
		'uniacid'=>$_SESSION['uniacid'],
		'store_id'=>$store_id,
		'status'=>1,
	);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$queue_num=pdo_getslice('jy_qiuyuyue_queue_member',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($queue_num){
		foreach($queue_num as &$v){
			$v['queuename'] = $queue[$v['queue_id']]['title'];
			$v['numid'] = $queue[$v['queue_id']]['pre'].$v['id'];
		}
	}
	//查询场馆设置
    $setting=$this->store_setting($store_id,'queue');
	$return['queue'] = $queue;
	$return['queue_num'] = $queue_num;
	$return['setting'] = $setting;
	set_html('title','排号大屏幕');
	exi($return);
}